package cn.nawang.ebeim.test.transfer;

import cn.nawang.ebeim.test.service.TestData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;

/**
 * Created by GanJc on 2015-12-23 16:46
 */
public class TransferReport implements TransferCallback {

    private static final Logger LOG = LoggerFactory.getLogger(TransferReport.class);

    @Override
    public void onTransferSuccess(FileInfo info) {
        TestData.setTotalSuccess(1);
        TestData.setTotalTransferBytes(new File(info.getPath()).length());
    }

    @Override
    public void onTransferFailed(FileInfo info,Throwable cause) {
        TestData.setTotalFailed(1);
        TestData.setTotalFailTransferBytes(new File(info.getPath()).length());
        LOG.info("TransferReport.onTransferFailed()" + cause);
    }

}
